package ua.com.bitlab.figures;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * User: Roman Boyarsky
 * Date: 4/10/12
 */
public class Circle implements Figure {

    private static final Logger log = LoggerFactory.getLogger(Circle.class);

    private int coordinateX;
    private int coordinateY;
    private int radius;

    public Circle(int coordinateX, int coordinateY, int radius) {
        this.coordinateX = coordinateX;
        if (this.coordinateX < 0) {
            this.coordinateX *= (-1);
        }
        this.coordinateY = coordinateY;
        if (this.coordinateY < 0) {
            this.coordinateY *= (-1);
        }
        this.radius = radius;
        if (this.radius < 0) {
            this.radius *= (-1);
        }

        log.debug("Creating circle with coordinates x=" + this.coordinateX + ", y=" + this.coordinateY
                + "; r=" + this.radius);
    }

    public int getCoordinateX() {
        return coordinateX;
    }

    public int getCoordinateY() {
        return coordinateY;
    }

    public int getRadius() {
        return radius;
    }

    @Override
    public void rotate(int angle) {
        log.debug("This action doesn't make sense for circle!");
    }

    @Override
    public void move(int newСoordinateX, int newСoordinateY) {
        coordinateX = newСoordinateX;
        coordinateY = newСoordinateY;

        log.debug("Changing circle position on x=" + coordinateX + ", y=" + coordinateY);
    }

    @Override
    public void resize(int modifier) {
        radius *= modifier;

        log.debug("New radius of circle is: " + radius);
    }
}
